window.onload = function(){
var islink = document.querySelector('.link');
var istitle = document.querySelector('.title')
let isprice = document.querySelector('.price');
let isimg = document.querySelector('.pro-bpic img');
let uid = Cookie.getCookie('yhid');
console.log('用户id：'+uid)
/*var isname = getUrlAttribute('pname');
var iprice = getUrlAttribute('pprice');
let iimg = getUrlAttribute('src');*/
let pid = getUrlAttribute('pid')

/*console.log(isname)
islink.innerHTML='&gt;'+isname;
istitle.innerHTML='&gt;'+isname;*/
/*isprice.innerHTML='￥'+iprice;
isimg.src=iimg;*/
var url6 = 'http://jx.xuzhixiang.top/ap/api/detail.php?id='+pid;
console.log(url6);
var jq = jQuery.noConflict();
jq.ajax({
	type:"get",
	url:url6,
	async:true,
	success:function(res){
		var obj = JSON.parse(res);
		console.log(obj.data.pname)
		islink.innerHTML='&gt;'+obj.data.pname;
		istitle.innerHTML='&gt;'+obj.data.pname;
		isprice.innerHTML='￥'+obj.data.pprice;
		isimg.src=obj.data.pimg;
		

		/*加入购物车*/
		
		var cart = document.querySelector('.cart');
		var pnum = document.querySelector('#quantity_231493');
		
		console.log(pnum.value)
		
		cart.onclick = function(){
			console.log(1)
			var url7 =`http://jx.xuzhixiang.top/ap/api/add-product.php?uid=${uid}&pid=${pid}&pnum=${pnum.value}`
			jq.ajax({
				type:"get",
				url:url7,
				async:true,
				success:function(){
					console.log('okk')
					alert('加入成功')
				}
			});
		}
	}
});





}


